<script>
	$(document).on("pageshow","#signDetailLarge",function(){
		openLoading();
		$(".sign_detail_large_box").hide();
		$(".sign_Detail_larger_box_replies").html("");
		$(".sign_Detail_larger_box_sign").html("");
		
		$(".sign_detail_large_not_found").hide();
		$(".sign_detail_large_loading").show();
		setMessage("sign.detail.large.not.found",".sign_detail_large_not_found");
		setMessage("sign.detail.replies.title",".sign-detail-replies-title");
		
		var idSign = getUrlVars()["id"];
			
		
		if (idSign != null) {
			$.ajax({
				type : "POST",
				url : getSignURL,
				data : {
					id_sign : idSign
				},
				success: function(sign) {
			        $(".sign_detail_large_loading").hide();
			        if (sign.value.id == null) {
			        	$(".sign_detail_large_not_found").show();
			   			$(".sign_detail_large_loading").hide();
			   			$(".sign_detail_large_box").hide();
			        } else {
			        	$(".sign_Detail_larger_box_sign").html(createSign(sign.value));
			        	$(".menu_insert_reply").attr("id_sign_father",sign.value.id);
				        loadReplies();
				        attachOpenSignDetail();
				        
				        $("#sign-"+sign.value.id+" .sign-footer").css("height","50px");
				        $("#sign-"+sign.value.id+" .sign-footer-replies").css("height","50px");
				        $("#sign-"+sign.value.id+" .sign-footer-number").css("height","50px");
				        
				        $(".sign_Detail_larger_box_colorfeel_red").html(sign.value.colorfeel_red);
				        $(".sign_Detail_larger_box_colorfeel_blue").html(sign.value.colorfeel_blue);
				        $(".sign_Detail_larger_box_colorfeel_green").html(sign.value.colorfeel_green);
				        
				        $(".sign_Detail_larger_box_colorfeel_red").click(function(){
				        	insertColorfeelSignDetailLarge(idSign, "red");
				        });
				        $(".sign_Detail_larger_box_colorfeel_blue").click(function(){
				        	insertColorfeelSignDetailLarge(idSign, "blue");
				        });
				        $(".sign_Detail_larger_box_colorfeel_green").click(function(){
				        	insertColorfeelSignDetailLarge(idSign, "green");
				        });
					}
			   	},
			   	failure: function(e) {
			   		$(".sign_detail_large_not_found").show();
			   		$(".sign_detail_large_loading").hide();
			   		$(".sign_detail_large_box").hide();
			   	},
				dataType : "JSON"
			});
		} else {
			$(".sign_detail_large_not_found").show();
			$(".sign_detail_large_loading").hide();
			$(".sign_detail_large_box").hide();
		}
		closeLoading();
	});
	
	function loadReplies() {
		$.ajax({
			type : "POST",
			url : repliesSignsURL,
			data : {
				id_sign_father : $(".menu_insert_reply").attr("id_sign_father")
			},
			success: function(replies) {
				$(".sign_Detail_larger_box_replies").html(getLoader());
				var repliesSign = replies.value;
				if (repliesSign.length == 0) {
					$(".sign_Detail_larger_box_replies").html("<li class=\"sign-detail-replies-li-noreplies\">"+getMessage("sign.detail.replies.no.replies")+"</li>");
				} else {
					$(".sign_Detail_larger_box_replies").html("");
					for (var i = 0; i < repliesSign.length; i++) {
						$(".sign_Detail_larger_box_replies").append(createSign(repliesSign[i]));
					}
				}
				$(".sign_detail_large_box").show();
				attachOpenSignDetail();
			},
		   	failure: function(e) {
		   		$(".sign_Detail_larger_box_replies").html("ERRORE!");
		   	},
			dataType : "JSON"
		});
	}
	
</script>
<div data-role="content" data-scroll="true">
	<div data-form="ui-body-a" class="ui-body-a">
		<div class="sign_detail_large_not_found" style="display: none"></div>
		<div class="sign_detail_large_loading loading_white" style="display: none"></div>
		<div class="sign_detail_large_box">
			<div class="sign_Detail_larger_box_sign"></div>
			<div class="sign_Detail_larger_box_colorfeel">
				<div class="sign_Detail_larger_box_colorfeel_color sign_Detail_larger_box_colorfeel_red"></div>
				<div class="sign_Detail_larger_box_colorfeel_color sign_Detail_larger_box_colorfeel_green"></div>
				<div class="sign_Detail_larger_box_colorfeel_color sign_Detail_larger_box_colorfeel_blue"></div>
			</div>
			<form class="sign_Detail_larger_box_reply sign-detail-reply-form">
				<textarea id="reply-sign" class="reply-sign" data-mini="true" onkeyup="countSignCharacters(this)"></textarea>
				<div style="margin:5px;font-size:18px;color:grey" class="reply-sign-signCharacters signCharacters">250</div>
				<a href="#" data-rel="close" class="menu_insert_reply ui-btn ui-shadow ui-corner-all ui-btn-a ui-mini" onclick="insertReplySignDetailLarge(this)"></a>
			</form>
			<div class="sign-detail-replies-title"></div>
			<ul class="sign_Detail_larger_box_replies"></ul>
		</div>
	</div>
</div>